package com.king.bean;

public class AccessToken {
    private String accessToken;
    private long expiredTime;

    public String getAccessToken() {
        return accessToken;
    }

    public void setAccessToken(String accessToken) {
        this.accessToken = accessToken;
    }

    public long getExpiredTime() {
        return expiredTime;
    }

    public void setExpiredTime(long expiredTime) {
        this.expiredTime = expiredTime;
    }

    public AccessToken(String accessToken, String expiredIn) {
        this.accessToken = accessToken;
        this.expiredTime = System.currentTimeMillis() +Integer.parseInt(expiredIn)  * 1000;
    }

    /**
     * token是否过期
     * @return
     */
    public boolean isExpired(){
        return System.currentTimeMillis()>this.expiredTime;
    }
}
